n,m = map(int,input().split())

data = []

for _ in range(n):
    data.append(list(map(int,input().split())))


last_s,last_l = data[0]
cnt = 0 if last_s > last_l else last_l - last_s
for d in data[1:-1]:
    s,l = d
    t = s - last_s
    print(t+cnt,end=' ')
    if s < l:
        cnt += l - s


    
    
